package com.hfuuwzy.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hfuuwzy.entity.Course;
import com.hfuuwzy.mapper.CourseMapper;
import com.hfuuwzy.service.CourseService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author wzy
 * @since 2023-03-25 00:00:00
 */
@Service
public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> implements CourseService {

    @Autowired
    private CourseMapper courseMapper;

    @Override
    public Page<Course> findPage(Page<Course> page, String name) {
        return courseMapper.findPage(page, name);
    }


    @Transactional
    @Override
    public void setStudentCourse(Integer studentId, Integer courseId) {
        courseMapper.deleteStudentCourse(studentId,courseId);
        courseMapper.setStudentCourse(studentId,courseId);
    }


}
